//
//  DDInterviewReplayCell.m
//  DingDongZP
//
//  Created by 杨政涛 on 16/11/1.
//  Copyright © 2016年 51ledian.com. All rights reserved.
//

#import "DDInterviewReplayCell.h"
#import "DDInterviewReply.h"

@interface DDInterviewReplayCell ()
@property (nonatomic, strong) UILabel *contentLab;
@end
@implementation DDInterviewReplayCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        self.contentLab = [[UILabel alloc] initWithFrame:CGRectZero];
        self.contentLab.backgroundColor = COLOR_FONT_MESSAGEBACKGROUND;
        self.contentLab.layer.cornerRadius = 4.0;
        self.contentLab.layer.masksToBounds = YES;
        self.contentLab.textAlignment = NSTextAlignmentCenter;
        self.contentLab.textColor = COLOR_FONT_DARK_GRAY;
        self.contentLab.font = [UIFont systemFontOfSize:14.0];
        [self.contentView addSubview:self.contentLab];
    }
    return self;
}

- (void)setDataModel:(RCMessageModel *)model
{
    [super setDataModel:model];
    
    if ([model.content isKindOfClass:[DDInterviewReply class]])
    {
        DDInterviewReply *message = (DDInterviewReply*)model.content;
        NSString *content = nil;
        
        if (model.messageDirection == MessageDirection_SEND) {
            
            
            if (message.interviewResultType == DDInterviewResultRefuse) {
                
                content = [NSString stringWithFormat:@"您拒绝了Boss%@的面试邀请",message.bossName];
            }
            
            if (message.interviewResultType == DDInterviewResultAgree) {
                
                content = [NSString stringWithFormat:@"您同意了Boss%@的面试邀请",message.bossName];
            }
            
        }
        else {
            
            
            if (message.interviewResultType == DDInterviewResultRefuse) {
                
                content = [NSString stringWithFormat:@"牛人%@拒绝了您的面试邀请",message.cattleName];
            }
            
            if (message.interviewResultType == DDInterviewResultAgree) {
                
                content = [NSString stringWithFormat:@"牛人%@同意了您的面试邀请",message.cattleName];
            }
        }
        self.contentLab.text = [NSString stringWithFormat:@"%@",content];
    }
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.contentLab.frame = CGRectMake(20, 0, 250, 30);
    self.contentLab.center = CGPointMake(self.frame.size.width/2, self.frame.size.height/2);
    UIView *portrait = (UIView *)self.portraitImageView;
    portrait.hidden = YES;
    [self.messageTimeLabel removeFromSuperview];
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

@end
